from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
from app import models
def login_view(request):
    if request.method ==  "POST":
        user_name = request.POST.get('user_name','')
        pass_word = request.POST.grt('pwd','')
        user = models.User.objects.get(user_name=user_name,pwd = pass_word)
        if user:
            if pass_word == user.pwd:
                request.session['IS_LOGIN'] = True
                request.session['user_name'] = user_name
                request.session['user_id'] = user.id
                return render(request,'index.html',{'user_name'})